using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FiltronASP.Modules.Abstracts;
using FiltronASP.Models.DAO.Interfaces;
using FiltronASP.Models;
using FiltronASP.Models.DAO.WIX;
using FiltronASP.Models.DAO.Extensions;
using FiltronASP.Models.DAO.Interfaces.WIX;
using FiltronASP.Models.DAO.Filtron;
using FiltronASP.Models.DAO.Interfaces.Filtron;
using FiltronASP.Helpers;
using FiltronASP.Helpers.Translations;

namespace FiltronASP.Modules
{
    public class mainSearch : AbstractModule
    {
        private Page currentPage;

        /// <summary>
        /// Klasa odpowiedzialna za generowanie contentu przez modul.
        /// </summary>
        /// <param name="page">biezaca strona</param>
        /// <returns>content</returns>
        public override string GenerateContent(FiltronASP.Models.Page page)
        {
            this.currentPage = page;
            string htmlToReturn = "";
            int languageId = Convert.ToInt32(page.language_id);
            htmlToReturn += "<div id=\"rightMenuBoxInnerWix\" class=\"rightMenuBoxInner\">";

            htmlToReturn += "<div class=\"catalogueDropdownContainer\">";
            htmlToReturn += "    <label for=\"carBrand\">" + translationHelper.getTranslation("_localization", languageId) + "</label>";
            htmlToReturn += "    <select onchange=\"mainSearchBaseChanger(this)\" name=\"\" id=\"id_marketChangerWix\">";
            htmlToReturn += "        <option value=\"-1\">" + translationHelper.getTranslation("_mainSearchselectLocalization", languageId) + "</option>";
            htmlToReturn += "        <option value=\"1\">" + translationHelper.getTranslation("_mainSearchLocalizationEU", languageId) + "</option>";
            htmlToReturn += "        <option value=\"2\">" + translationHelper.getTranslation("_mainSearchLocalizationUS", languageId) + "</option>";
            htmlToReturn += "    </select>";
            htmlToReturn += "</div>";

            htmlToReturn += "<div class=\"catalogueDropdownContainer\">";
            htmlToReturn += "<label for=\"id_masterWix\">" + translationHelper.getTranslation("_mainSearchVehicleType", languageId) + "</label>";
            htmlToReturn += "    <select onchange=\"doBrandWorkWix('id_masterWix', 'id_BrandDetailWix', '" + Helpers.XmlHelper.XMLHelper.getLanguageNameById(Convert.ToInt32(page.language_id)) + "')\" id=\"id_masterWix\" name=\"passenger_car\" id=\"cat_firstSelect\" >";


            htmlToReturn += "<option value=\"-1\">" + translationHelper.getTranslation("_mainSearchSelectVehicleType", languageId) + "</option>";
            htmlToReturn += "<option value=\"7\">" + translationHelper.getTranslation("_searchPassenger", languageId) + "</option>";
            htmlToReturn += "<option value=\"8\">" + translationHelper.getTranslation("_searchTruck", languageId) + "</option>";
            htmlToReturn += "<option value=\"6\">" + translationHelper.getTranslation("_searchMachine", languageId) + "</option>";
            htmlToReturn += "<option value=\"9\">" + translationHelper.getTranslation("_searchMoto", languageId) + "</option>";
            htmlToReturn += "<option value=\"10\">" + translationHelper.getTranslation("_searchQuad", languageId) + "</option>";

            htmlToReturn += "    </select>";
            htmlToReturn += "</div>";
            htmlToReturn += "<div class=\"catalogueDropdownContainer\">";
            htmlToReturn += "    <label for=\"carBrand\">" + translationHelper.getTranslation("_catBrand", languageId) + "</label>";
            htmlToReturn += "    <select onchange=\"doTypeWorkWix('id_BrandDetailWix', 'id_TypeDetailWix', '" + Helpers.XmlHelper.XMLHelper.getLanguageNameById(Convert.ToInt32(page.language_id)) + "')\" name=\"\" id=\"id_BrandDetailWix\">";
            htmlToReturn += "        <option value=\"\">" + translationHelper.getTranslation("_selectManufacturer", languageId) + "</option>";
            htmlToReturn += "    </select>";
            htmlToReturn += "</div>";
            htmlToReturn += "<div class=\"catalogueDropdownContainer\">";
            htmlToReturn += "    <label for=\"carType\">" + translationHelper.getTranslation("_catModel", languageId) + "</label>";
            htmlToReturn += "    <select onchange=\"doActiveSubmitWIX('" + Helpers.XmlHelper.XMLHelper.getLanguageNameById(Convert.ToInt32(page.language_id)) + "')\" name=\"\" id=\"id_TypeDetailWix\">";
            htmlToReturn += "        <option value=\"\">" + translationHelper.getTranslation("_selectModel", languageId) + "</option>";
            htmlToReturn += "    </select>";
            htmlToReturn += "</div>";
            htmlToReturn += "<a id=\"ddsubmitWix\" href=\"javascript:return false;\" class=\"searchSubmitDDs\">" + translationHelper.getTranslation("_go", languageId) + "</a>";
            htmlToReturn += "<p style=\"clear: both; margin-top: 47px;\">" + translationHelper.getTranslation("_mainSearchInfo", languageId) + "</p>";
            htmlToReturn += "<input type=\"text\" id=\"query\" class=\"searchInput\" name=\"searchString\" />";
            htmlToReturn += "<a style=\"cursor: pointer;\" onclick=\"javascript:makeSearchByStringWix('" + Helpers.XmlHelper.XMLHelper.getLanguageNameById(Convert.ToInt32(page.language_id)) + "')\" class=\"searchSubmit\">" + translationHelper.getTranslation("_search", languageId) + "</a>";
            htmlToReturn += "</div>";

            // część Filtronowa

            htmlToReturn += "<div id=\"rightMenuBoxInnerFiltron\" class=\"rightMenuBoxInner\">";
            htmlToReturn += "<div class=\"catalogueDropdownContainer\">";

            htmlToReturn += "    <label for=\"carBrand\">" + translationHelper.getTranslation("_localization", languageId) + "</label>";
            htmlToReturn += "    <select onchange=\"mainSearchBaseChanger(this)\" name=\"\" id=\"id_marketChanger\">";
            htmlToReturn += "        <option value=\"-1\">" + translationHelper.getTranslation("_mainSearchselectLocalization", languageId) + "</option>";
            htmlToReturn += "        <option value=\"1\" selected=\"selected\">" + translationHelper.getTranslation("_mainSearchLocalizationEU", languageId) + "</option>";
            htmlToReturn += "        <option value=\"2\">" + translationHelper.getTranslation("_mainSearchLocalizationUS", languageId) + "</option>";
            htmlToReturn += "    </select>";
            htmlToReturn += "</div>";

            htmlToReturn += "<div class=\"catalogueDropdownContainer\">";
            htmlToReturn += "<label for=\"id_master\">" + translationHelper.getTranslation("_mainSearchVehicleType", languageId) + "</label>";
            htmlToReturn += "    <select onchange=\"doBrandWorkFiltron('id_master', 'id_BrandDetail', '" + Helpers.XmlHelper.XMLHelper.getLanguageNameById(Convert.ToInt32(page.language_id)) + "')\" id=\"id_master\" name=\"passenger_car\" id=\"cat_firstSelect\" >";

            htmlToReturn += "<option value=\"-1\">" + translationHelper.getTranslation("_mainSearchSelectVehicleType", languageId) + "</option>";
            htmlToReturn += "<option value=\"2\">" + translationHelper.getTranslation("_searchPassenger", languageId) + "</option>";
            htmlToReturn += "<option value=\"3\">" + translationHelper.getTranslation("_searchTruck", languageId) + "</option>";
            htmlToReturn += "<option value=\"6,w\">" + translationHelper.getTranslation("_searchMachine", languageId) + "</option>";
            htmlToReturn += "<option value=\"1\">" + translationHelper.getTranslation("_searchOther", languageId) + "</option>";
            htmlToReturn += "<option value=\"9,w\">" + translationHelper.getTranslation("_searchMoto", languageId) + "</option>";
            htmlToReturn += "<option value=\"10,w\">" + translationHelper.getTranslation("_searchQuad", languageId) + "</option>";

            htmlToReturn += "    </select>";
            htmlToReturn += "</div>";
            htmlToReturn += "<div class=\"catalogueDropdownContainer\">";
            htmlToReturn += "    <label for=\"carBrand\">" + translationHelper.getTranslation("_catBrand", languageId) + "</label>";
            htmlToReturn += "    <select onchange=\"doTypeWorkFiltron('id_BrandDetail', 'id_TypeDetail', '" + Helpers.XmlHelper.XMLHelper.getLanguageNameById(Convert.ToInt32(page.language_id)) + "')\" name=\"\" id=\"id_BrandDetail\">";
            htmlToReturn += "        <option value=\"\">" + translationHelper.getTranslation("_selectManufacturer", languageId) + "</option>";
            htmlToReturn += "    </select>";
            htmlToReturn += "</div>";
            htmlToReturn += "<div class=\"catalogueDropdownContainer\">";
            htmlToReturn += "    <label for=\"carType\">" + translationHelper.getTranslation("_catModel", languageId) + "</label>";
            htmlToReturn += "    <select onchange=\"doActiveSubmit('" + Helpers.XmlHelper.XMLHelper.getLanguageNameById(Convert.ToInt32(page.language_id)) + "')\" name=\"\" id=\"id_TypeDetail\">";
            htmlToReturn += "        <option value=\"\">" + translationHelper.getTranslation("_selectModel", languageId) + "</option>";
            htmlToReturn += "    </select>";
            htmlToReturn += "</div>";
            htmlToReturn += "<a id =\"ddsubmitFiltron\" href=\"javascript:return false;\" class=\"searchSubmitDDs\">" + translationHelper.getTranslation("_go", languageId) + "</a>";
            htmlToReturn += "<p style=\"clear: both; margin-top: 47px;\">" + translationHelper.getTranslation("_mainSearchInfo", languageId) + "</p>";
            htmlToReturn += "<input type=\"text\" id=\"queryFiltron\" class=\"searchInput searchInputFiltron\" name=\"searchString\" />";
            htmlToReturn += "<a style=\"cursor: pointer;\" onclick=\"javascript:makeSearchByStringWix('" + Helpers.XmlHelper.XMLHelper.getLanguageNameById(Convert.ToInt32(page.language_id)) + "')\" class=\"searchSubmit\">" + translationHelper.getTranslation("_search", languageId) + "</a>";
            htmlToReturn += "<div class=\"multiSearchContainer\" onclick=\"javascript:redirectToMultiSearch('" + Helpers.XmlHelper.XMLHelper.getLanguageNameById(Convert.ToInt32(page.language_id)) + "')\">";
            htmlToReturn += "<img src=\"../../../Content/images/lupa.png\"/ class=\"multiSearchImage\">";
            htmlToReturn += "<span class=\"multiSearchWrapper\">" + translationHelper.getTranslation("_mainMultisearchInfo", languageId) + "</span>";
            htmlToReturn += "</div>";
            htmlToReturn += "</div>";

            return htmlToReturn;
        }
    }
}
